from math import *
x3=[]
n =0
x = int(input())
for i in range (x):
x5=0
x2 = int(input())
x3=list (map(int,input().split()))
x4 =tuple( x3)
x3.sort()
x3.reverse()
x6= x4.index(x3[0])
if x6 == 0:
for i2 in range(len(x3)-1):
if int(x4[i2]) == int(x4[i2+1]):
x6=x6+1
else :
break
for i1 in range (len(x3)-1):
if x3[i1] > x3[i1+1] :
x5=x5+1
if x5>0: print (x6+1)
else :print(-1)
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
template<class T> using ordered_set = tree<T, null_type, std::less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define debug(x) cerr << getVName(x) <<" = " << x << '\n';
#define ll long long
#define ld long double
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define bit(mask, i) (((mask)>>(i))&1)
#define F first
#define S second
using namespace std;
int mod = 1e9 + 7;
const int N = 2e5 + 9;
ll inf = 1e18 + 7;
double PI = acos(-1);
double EPS = 1e-9;
bool valid(ll x){
ll s=0,y=x;;
while(x){
s+=x%10;
x/=10;
}
return __gcd(y,s)>1;
}
signed main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
int t;
cin>>t;
while(t--){
int n;
cin>>n;
vector<int>a(n+2,mod);
int mx=0;
for(int i=1;i<=n;i++){
cin>>a[i];;
mx=max(mx,a[i]);
}
int ans=-1;
for(int i=1;i<=n;i++){
if(a[i]==mx&&(a[i]>a[i-1]||a[i]>a[i+1])){
ans=i;
}
}
cout<<ans<<"\n";
}
return 0;
}
34A - Reconnaissance 2 | 59A - Word |
462B - Appleman and Card Game | 1560C - Infinity Table |
1605C - Dominant Character | 1399A - Remove Smallest |
208A - Dubstep | 1581A - CQXYM Count Permutations |
337A - Puzzles | 495A - Digital Counter |
796A - Buying A House | 67A - Partial Teacher |
116A - Tram | 1472B - Fair Division |
1281C - Cut and Paste | 141A - Amusing Joke |
112A - Petya and Strings | 677A - Vanya and Fence |
1621A - Stable Arrangement of Rooks | 472A - Design Tutorial Learn from Math |
1368A - C+= | 450A - Jzzhu and Children |
546A - Soldier and Bananas | 32B - Borze |
1651B - Prove Him Wrong | 381A - Sereja and Dima |
41A - Translation | 1559A - Mocha and Math |
832A - Sasha and Sticks | 292B - Network Topology |